home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / SCSetScanEnt.z / SCSetScanEnt
Text File  |  1998-10-30  |  6KB  |  133 lines

  1.  
  2.  
  3.  
  4. SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      SCSetScanEnt, SCGetScanEnt, SCEndScanEnt - Getting information about
  10.      installed scanners
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccaaaannnnnnnneeeerrrr....hhhh>>>>
  15.  
  16.      FFFFIIIILLLLEEEE ****SSSSCCCCSSSSeeeettttSSSSccccaaaannnnEEEEnnnntttt((((vvvvooooiiiidddd))));;;;
  17.  
  18.      SSSSCCCCAAAANNNNEEEENNNNTTTT ****SSSSCCCCGGGGeeeettttSSSSccccaaaannnnEEEEnnnntttt((((FFFFIIIILLLLEEEE ****ffffpppp))));;;;
  19.  
  20.      iiiinnnntttt SSSSCCCCEEEEnnnnddddSSSSccccaaaannnnEEEEnnnntttt((((FFFFIIIILLLLEEEE ****ffffpppp))));;;;
  21.  
  22. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.      These routines provide a programmatic interface for reading the file
  24.      /_u_s_r/_l_i_b/_s_c_a_n/_s_c_a_n_n_e_r_s, which contains a one line entry specifying the
  25.      name, driver, device, and options program for each scanner installed on
  26.      the system.
  27.  
  28.      _S_C_S_e_t_S_c_a_n_E_n_t opens /_u_s_r/_l_i_b/_s_c_a_n/_s_c_a_n_n_e_r_s, returning a pointer to a FFFFIIIILLLLEEEE
  29.      structure.  _S_C_G_e_t_S_c_a_n_E_n_t parses the next line of _f_p into a _S_C_A_N_E_N_T
  30.      structure, which is declared in <_s_c_a_n_n_e_r._h> as follows:
  31.  
  32.           typedef struct tag_scanent {
  33.               char *name;
  34.               char *driver;
  35.               char *device;
  36.               char *options;
  37.           } SCANENT;
  38.  
  39.  
  40.      In this structure, _n_a_m_e is the name of the scanner assigned by the system
  41.      administrator using _s_c_a_n_n_e_r_s(1M) at the time the scanner was installed.
  42.      _d_r_i_v_e_r is the name of the scanner driver for this scanner.  _d_e_v_i_c_e is the
  43.      device parameter passed to the driver, and _o_p_t_i_o_n_s is the scanner
  44.      specific options program for this scanner.
  45.  
  46.      From a scanner application's point of view, _n_a_m_e is the only significant
  47.      field.  _n_a_m_e is the string to be passed to _S_C_O_p_e_n(3) to open a scanner.
  48.  
  49. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  50.      _S_C_S_e_t_S_c_a_n_E_n_t returns a pointer to a _F_I_L_E structure if successful, or NULL
  51.      if an error occurs.
  52.  
  53.      _S_C_G_e_t_S_c_a_n_E_n_t returns a pointer to a _S_C_A_N_E_N_T structure, or NULL if there
  54.      are no more scanners left to parse in /_u_s_r/_l_i_b/_s_c_a_n/_s_c_a_n_n_e_r_s.
  55.  
  56.      _S_C_E_n_d_S_c_a_n_E_n_t returns 0 if successful, -1 if error.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333))))
  71.  
  72.  
  73.  
  74.      In the event of an error, _S_C_S_e_t_S_c_a_n_E_n_t and _S_C_E_n_d_S_c_a_n_E_n_t will set _S_C_e_r_r_n_o
  75.      to indicate the cause of the error.
  76.  
  77. EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN EEEERRRRRRRROOOORRRR CCCCOOOODDDDEEEESSSS
  78.      SCENOSCANNERS            No scanners are installed
  79.  
  80.      In addition, these functions may fail as the result of a failed system
  81.      call, in which case _S_C_e_r_r_n_o will be set to a value from
  82.      /_u_s_r/_i_n_c_l_u_d_e/_s_y_s/_e_r_r_n_o._h.
  83.  
  84. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  85.      The following example prints out the names of all installed scanners.  A
  86.      scanner application can use these functions to present a list of
  87.      installed scanners to the user, so the user can select which one to open.
  88.  
  89.           #include <stdio.h>
  90.           #include <scanner.h>
  91.  
  92.           int
  93.           main(void)
  94.           {
  95.               FILE *fp;
  96.               SCANENT *ent;
  97.  
  98.               if ((fp = SCSetScanEnt()) == NULL) {
  99.                   SCPerror("SCSetScanEnt");
  100.                   exit(1);
  101.               }
  102.  
  103.               printf("Installed scanners:\n");
  104.               while ((ent = SCGetScanEnt(fp)) != NULL) {
  105.                   printf("%s\n", ent->name);
  106.               }
  107.  
  108.               SCEndScanEnt(fp);
  109.               exit(0);
  110.           }
  111.  
  112.  
  113. WWWWAAAARRRRNNNNIIIINNNNGGGG
  114.      The return value of _S_C_G_e_t_S_c_a_n_E_n_t points to memory owned by _l_i_b_s_c_a_n(3).
  115.      The calling program should not modify the memory pointed to by the return
  116.      value of _S_C_G_e_t_S_c_a_n_E_n_t, nor should any assumptions be made about its value
  117.      after subsequent calls to _S_C_G_e_t_S_c_a_n_E_n_t.  Any needed information should be
  118.      copied into program memory before calling _S_C_G_e_t_S_c_a_n_E_n_t again.
  119.  
  120. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  121.      _l_i_b_s_c_a_n(3), _S_C_O_p_e_n(3), _s_c_a_n_n_e_r_s(1M).
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.